<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  var a = 2;
  var b = 7;

  if ((a === 0) ^ (b === 0)) {
    console.log('xxxxxxxxxxx')
  }

  if ((a === 0) !== (b === 0)) {
    console.log('xxxxxxxxxxx')
  }

  a ^= b;

  console.log(a, b)

  for (var i = 0; i < 20; i++) {
    // console.log(i.toString(2))
  }

  const s = 1;
  const t = 2;
  const f = 4;
  const g = 8;
  let o = 0;

  o = o | s
  console.log(o)
  o = o | t
  console.log(o)
  o = o | f
  console.log(o)
  o = o | g
  console.log(o)
  console.log((8).toString(2))
  console.log((9).toString(2))
  console.log((10).toString(2))
  console.log((11).toString(2))
  console.log((12).toString(2))
  console.log((13).toString(2))
  console.log((14).toString(2))
  console.log((15).toString(2))
  console.log((16).toString(2))
  // 十进制 => 二进制
  let num = 10;
  console.log(num.toString(2));
  // 二进制 => 十进制
  let num1 = 1001;
  console.log(parseInt(num1, 2));


  let sa = 5, vb = 6;

  sa = sa ^ vb;
  vb = sa ^ vb;
  sa = sa ^ vb;

  console.log(sa, vb);

</script>
</body>
</html>
